home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_06 / gotwals / times.cpp < prev   
Text File  |  1994-04-01  |  626b  |  21 lines

  1. ====================== Listing 5 ======================
  2. void multiply(const int *u, const int *v, int *w,
  3.       int n, int m); // multiply prototype
  4.  
  5. /* multiplication : lint3 = lint1 * lint2;
  6.    --------------------------------------- */
  7. LargeInt LargeInt::operator*(const LargeInt& lint)
  8.       const {
  9.    if (sign == 0  || lint.sign == 0)
  10.       return zero;
  11.    LargeInt result(len + lint.len, 0);
  12.    if (sign == lint.sign)
  13.       result.sign = 1;
  14.    else
  15.       result.sign = -1;
  16.    multiply(adr, lint.adr, result.adr, len, lint.len);
  17.    if (*result.adr == 0)
  18.       result.normalize();
  19.    return result;
  20. }
  21.